//
//  LoveViewController.m
//  News
//
//  Created by weige on 16/5/29.
//  Copyright © 2016年 weige. All rights reserved.
//

#import "LoveViewController.h"
#import "LoveHomeViewController.h"
#import "HomeLoveViewController.h"

// Animations
#import "PJXBounceAnimation.h"
#import "PJXFumeAnimation.h"
#import "PJXRotationAnimation.h"

#import "PJXAnimatedTabBarController.h"
#import "PJXAnimatedTabBarItem.h"
#import "PJXIconView.h"
#import "testViewController.h"
#import "ThreeViewController.h"
#import "MyAboutViewController.h"
#import "WYTabBar.h"
@interface LoveViewController ()
@end

@implementation LoveViewController


- (void)viewDidLoad {
    
    
    /*!
     *  @author weige, 16-06-11 16:06:52
     *
     *  @brief 这里必须这样调换位置会发生布局参数错误
     */
    //self.delegate=self;
    [self CreateViewsInforTabBar];
    
    [super viewDidLoad];
  
    
}

-(void)CreateViewsInforTabBar
{
    //NewsTableViewController *home=[[NewsTableViewController alloc]init];
    
   
    HomeLoveViewController *home=[[HomeLoveViewController alloc]init];
    UINavigationController *nav1=[[UINavigationController alloc]initWithRootViewController:home];
    //NSLog(@"%@",self.tabimag);
 
    nav1.tabBarItem=[self tabBartitle:@"首页" andimageName:@"v2" andtextSelectedColor:[UIColor orangeColor] andicoColor:[UIColor  orangeColor] andtextColor:[UIColor lightGrayColor]];
    testViewController *te=[[testViewController alloc]init];
    UINavigationController *nav2=[[UINavigationController alloc]initWithRootViewController:te];
    nav2.tabBarItem=[self tabBartitle:@"超市" andimageName:@"v2_order_r" andtextSelectedColor:[UIColor orangeColor] andicoColor:[UIColor orangeColor] andtextColor:[UIColor lightGrayColor]];
    ThreeViewController *three=[[ThreeViewController alloc]init];
    UINavigationController *nav3=[[UINavigationController alloc]initWithRootViewController:three];
    MyAboutViewController *myvc=[[MyAboutViewController alloc]init];
    UINavigationController *nav4=[[UINavigationController alloc]initWithRootViewController:myvc];
    self.viewControllers=@[nav1,nav2,nav3,nav4];
    WYTabBar *tabBar=[[WYTabBar alloc] init];
    // self.tabBar
    /*!
     *  @author weige, 16-06-07 23:06:35
     *
     *  @brief 修改系统的tabbar不能直接使用self.tabBar的方式调用set方法进行更换，因为这个属性是只读的，这里的实现是直接使用KVC把它内部的
     */
    [self setValue:tabBar forKeyPath:@"tabBar"];
    nav3.tabBarItem=[self tabBartitle:@"购物车" andimageName:@"shopCart_r" andtextSelectedColor:[UIColor orangeColor] andicoColor:[UIColor orangeColor] andtextColor:[UIColor lightGrayColor]];
    nav4.tabBarItem=[self tabBartitle:@"我的" andimageName:@"v2_my_r" andtextSelectedColor:[UIColor orangeColor] andicoColor:[UIColor orangeColor] andtextColor:[UIColor lightGrayColor]];
   // nav4.navigationBarHidden=YES;
    
   
}




/*!
 *  @author weige, 16-06-06 15:06:54
 *
 *  @brief 自定义方法
 *
 *  @param title       显示名称
 *  @param imageName   图片名称
 *  @param selectColor 选中颜色
 *  @param icoColor    图片颜色
 *  @param textColor   文本颜色
 *
 *  @return 返回PJXAnimatedTabBarItem
 */
-(PJXAnimatedTabBarItem *)tabBartitle:(NSString *)title andimageName:(NSString *)imageName andtextSelectedColor:(UIColor *)selectColor andicoColor:(UIColor *)icoColor andtextColor:(UIColor *)textColor
{
    PJXBounceAnimation *rotationAnimation = [[PJXBounceAnimation alloc] init];
    rotationAnimation.textSelectedColor = selectColor;
    rotationAnimation.iconSelectedColor = icoColor;
    
    PJXAnimatedTabBarItem *thirdTabBarItem = [[PJXAnimatedTabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:imageName] selectedImage:nil];
    thirdTabBarItem.animation = rotationAnimation;
    thirdTabBarItem.textColor = textColor;
    UIImageView *thirdIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
    UILabel *thirdLabel = [[UILabel alloc] init];
    thirdLabel.text = title;
    thirdTabBarItem.iconView = [[PJXIconView alloc] initWithIcon:thirdIconView textLabel:thirdLabel];
    return thirdTabBarItem;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
